/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

/* Room control interface */
.room-control {
    text-align: center;
    padding: 40px 20px;
}

.room-input-group {
    margin-bottom: 20px;
    margin-top: 20px;
}

#roomIdInput {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#roomIdInput:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.room-hint {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

.room-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Button styles */
.btn-primary {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: #64748b;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.user-info {
    position: fixed;
    top: 10px;
    right: 20px;
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-logout {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 5px 12px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.btn-logout:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Top control bar */
.top-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.left-control,
.center-control,
.right-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-control {
    background-color: #64748b;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-control:hover {
    background-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn-control.active {
    background-color: #2563eb;
}

.btn-control.active:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#copyLink,
#leaveBtn {
    background-color: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

#copyLink:hover,
#leaveBtn:hover {
    background-color: #f1f5f9;
}

/* Video area */
.video-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.video-container {
    position: relative;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.video-container:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
    background-color: #000;
}

.username-label {
    background-color: #2563eb;
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: 14px;
}

.remote-videos {
    display: contents;
}

/* Fullscreen video */
.video-fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#fullscreenVideo {
    max-width: 90%;
    max-height: 90%;
}

.btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.btn-close:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Bottom area */
.bottom-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.chat-area,
.whiteboard-area {
    flex: 1;
    min-width: 300px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}

.chat-window {
    height: 400px;
    /* 与画板高度一致 */
    width: 100%;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#chat-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* 聊天消息气泡样式 */
.message-bubble {
    display: flex;
    margin: 10px;
    max-width: 70%;
    flex-direction: column;
}

.self-message {
    align-self: flex-end;
    margin-left: auto;
}

.self-message .message-content {
    background-color: #95ec69;
    /* 微信风格绿色 */
    color: #000;
    border-radius: 8px 8px 0 8px;
    padding: 8px 12px;
    position: relative;
}

.self-message .message-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: -8px;
    border-left: 8px solid #95ec69;
    border-bottom: 8px solid transparent;
}

.other-message {
    align-self: flex-start;
    margin-right: auto;
}

.other-message .message-content {
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px 8px 8px 0;
    padding: 8px 12px;
    position: relative;
}

.other-message .message-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -8px;
    border-right: 8px solid #ffffff;
    border-bottom: 8px solid transparent;
    border-right-color: #ffffff;
    border-left-color: transparent;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.self-message .message-header {
    flex-direction: row-reverse;
    /* 自己消息反转用户名和时间 */
}

.message-header .username {
    font-weight: bold;
    color: #1e293b;
}

.self-message .username {
    color: #000;
}

.message-header .timestamp {
    color: #64748b;
}

.message-text {
    font-size: 14px;
    word-break: break-word;
}

.system-message {
    margin: 10px auto;
    padding: 6px 12px;
    background-color: #dfe4ea;
    color: #1e293b;
    border-radius: 12px;
    font-size: 12px;
    text-align: center;
    max-width: 80%;
    display: inline-block;
}

/* Whiteboard area */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn-tool {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-tool:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#whiteboard {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 100%;
}

/* Member list */
.member-list {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    min-width: 150px;
}

.member-header {
    padding: 10px;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.members {
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.member-item {
    padding: 5px 10px;
    background-color: #e2e8f0;
    margin: 5px 0;
    border-radius: 4px;
}

/* Prompt overlay */
.prompt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.prompt-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.prompt-title {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #1e293b;
}

.prompt-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.prompt-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.prompt-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    float: right;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
}

.close-btn:hover {
    color: #1e293b;
}

.history-list-container {
    margin-top: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

#historyTable {
    width: 100%;
    border-collapse: collapse;
}

#historyTable th,
#historyTable td {
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: center;
    min-width: 100px;
    /* 确保列宽足够 */
}

#historyTable th {
    background-color: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 10;
}

#historyTable tbody tr:hover {
    background-color: #f1f5f9;
    cursor: pointer;
}

/* Login and Register Pages */
.container.login-container,
.container.register-container {
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.container.login-container h2,
.container.register-container h2 {
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
}

#loginForm,
#registerForm {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* 减小间距以适配移动端 */
}

#loginForm input,
#registerForm input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#loginForm input:focus,
#registerForm input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

#loginForm button,
#registerForm button {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

#loginForm button:hover,
#registerForm button:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#loginForm button:disabled,
#registerForm button:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#loginForm p,
#registerForm p {
    text-align: center;
    color: #64748b;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.5;
}

#loginForm a,
#registerForm a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.3s ease;
}

#loginForm a:hover,
#registerForm a:hover {
    color: #1d4ed8;
}

/* Responsive design */
@media (max-width: 768px) {
    .top-control {
        flex-direction: column;
        gap: 15px;
    }

    .video-area {
        grid-template-columns: 1fr;
    }

    .bottom-area {
        flex-direction: column;
    }

    .chat-area,
    .whiteboard-area {
        width: 100%;
    }

    #whiteboard {
        width: 100%;
        height: 400px;
    }

    .container.login-container,
    .container.register-container {
        width: 100%;
        max-width: 90%;
        margin: 15px auto;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        /* 减弱阴影 */
    }

    #loginForm input,
    #registerForm input {
        padding: 8px;
        font-size: 14px;
        /* 减小字体 */
    }

    #loginForm button,
    #registerForm button {
        padding: 10px;
        font-size: 14px;
    }

    #loginForm p,
    #registerForm p {
        font-size: 12px;
        margin-top: 10px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-list-container {
        max-height: 60vh;
    }

    .message-bubble {
        max-width: 85%;
        /* 小屏幕上气泡更宽 */
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 延迟显示样式 */
.latency-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: color 0.3s;
}

/* 根据延迟值动态调整颜色 */
.latency-low {
    color: #28a745;
    /* 绿色，延迟 < 100ms */
}

.latency-medium {
    color: #ffc107;
    /* 黄色，100ms ≤ 延迟 ≤ 300ms */
}

.latency-high {
    color: #dc3545;
    /* 红色，延迟 > 300ms */ }

/* styles.css */

/* 遮罩层 */
#custom-alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
}

/* 弹窗容器 */
#custom-alert-box {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 8px;
    width: 320px;
    max-width: 80%;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    font-family: "Helvetica Neue", Arial, sans-serif;
}

/* 标题 */
#custom-alert-title {
    margin: 0 0 12px;
    font-size: 18px;
    color: #333333;
}

/* 消息文本 */
#custom-alert-message {
    font-size: 14px;
    color: #444444;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* 按钮区域 */
#custom-alert-box>div {
    text-align: right;
}

/* 确定按钮 */
#custom-alert-ok {
    background-color: #007bff;
    /* 主色，可改成你页面的主题色 */
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#custom-alert-ok:hover {
    background-color: #0056b3;
    /* 悬浮颜色 */
}

#custom-alert-ok:active {
    background-color: #004085;
    /* 点击颜色 */
}

#custom-alert-ok:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

/* 历史记录详情模态框 */
#historyDetailModal .modal-content {
    max-width: 900px;
    padding: 20px;
}

.history-detail-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-detail-info {
    background-color: #f1f5f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.history-detail-info p {
    margin: 5px 0;
    font-size: 14px;
}

.history-detail-info strong {
    color: #1e293b;
}

.history-detail-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#historyChatWindow {
    height: 300px;
    overflow-y: auto;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 10px;
}

#historyWhiteboard {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #historyDetailModal .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    #historyChatWindow {
        height: 200px;
    }

    #historyWhiteboard {
        width: 100%;
        height: 300px;
    } }


